package day06;

import java.util.Arrays;
import java.util.Random;

public class generate {
    public static void main(String[] args) {
        //赋值输出
        int[] a = Array(5, 100);
        System.out.println(Arrays.toString(a));
    }
    //返回值类型为int[]
    public static int[] Array(int length, int endNum) {
        //初始化数组
        int[] arr = new int[length];
        //创建随机数对象
        Random r = new Random();
        //循环遍历数组
        for (int i = 0; i < arr.length; i++) {
            int num = r.nextInt(endNum);
            arr[i] = num;
        }
        //返回数组
        return arr;
    }
}